import request from '@/utils/request'

// 订单管理
const userApi = {
    queryGoodsOrder: '/web/query/goods/order', // 查询商品订单
    queryGoodsOrderExpress: '/web/query/goods/order/express/info', // 查询商品订单快递信息
    updateGoodsOrderStatus: '/web/update/goods/order/status/receiving', // 修改订单状态为已发货
    queryGoodsAftersale: '/web/query/goods/after/sales/info', // 查询商品售后信息
    updateGoodsAftersale: '/web/examine/goods/after/sales', // 审核商品售后
    excelGoodsOrder: '/web/query/goods/order', // 是否导出excel(0:否,1:是)	
    updateGoodsOrderReceiveExcel: '/web/batch/update/goods/order/status/receiving', // 批量导入物流单号
    downloadGoodsOrderReceiveExcelTem: '/web/batch/update/goods/order/status/receiving', // 下载物流导入单号模板
}
/**
 * @param parameter
 * @returns {*}
 */
// 查询商品订单
export function queryGoodsOrder(parameter){
  return request({
      url: userApi.queryGoodsOrder,
      method: 'post',
      headers: {
          'name':'queryGoodsOrder',
      },
      data: parameter,
  })
}
// 查询商品订单快递信息
export function queryGoodsOrderExpress(parameter){
    return request({
        url: userApi.queryGoodsOrderExpress,
        method: 'post',
        headers: {
            'name':'queryGoodsOrderExpress',
        },
        data: parameter,
    })
  }
 // 修改订单状态为已发货
export function updateGoodsOrderStatus(parameter){
    return request({
        url: userApi.updateGoodsOrderStatus,
        method: 'post',
        headers: {
            'name':'updateGoodsOrderStatus',
        },
        data: parameter,
    })
  }
 // 查询商品售后信息
export function queryGoodsAftersale(parameter){
    return request({
        url: userApi.queryGoodsAftersale,
        method: 'post',
        headers: {
            'name':'queryGoodsAftersale',
        },
        data: parameter,
    })
  }
  // 审核商品售后
export function updateGoodsAftersale(parameter){
    return request({
        url: userApi.updateGoodsAftersale,
        method: 'post',
        headers: {
            'name':'updateGoodsAftersale',
        },
       
    })
}
 
    // 导出订单
export function excelGoodsOrder(parameter){
    return request({
        url: userApi.excelGoodsOrder,
        method: 'get',
        headers: {
            'name':'queryGoodsOrder',
        },
        responseType: 'blob',
        // responseType: 'arraybuffer', //二进制流
        params: parameter,
    })
}
 
// 批量导入物流单号
export function updateGoodsOrderReceiveExcel(parameter){
    return request({
        url: userApi.updateGoodsOrderReceiveExcel,
        method: 'post',
        headers: {
            'file':true,
            'name':'updateGoodsOrderReceiveExcel',
        },
        data: parameter,
    })
}
// 下载物流导入单号模板
export function downloadGoodsOrderReceiveExcelTem(parameter){
    return request({
        url: userApi.downloadGoodsOrderReceiveExcelTem,
        method: 'get',
        headers: {
            'name':'updateGoodsOrderReceiveExcel',
        },
        responseType: 'arraybuffer', //二进制流
        params: parameter,
    })
}